/*  1:   */ package com.atomikos.beans;
/*  2:   */ 
/*  3:   */ import java.awt.Component;
/*  4:   */ import java.awt.GridBagConstraints;
/*  5:   */ import java.awt.GridBagLayout;
/*  6:   */ import java.awt.event.ActionEvent;
/*  7:   */ import java.awt.event.ActionListener;
/*  8:   */ import java.beans.PropertyEditor;
/*  9:   */ import javax.swing.JComboBox;
/* 10:   */ import javax.swing.JLabel;
/* 11:   */ import javax.swing.JPanel;
/* 12:   */ 
/* 13:   */ public class ComboBoxComponent
/* 14:   */   extends AbstractPropertyEditorComponent
/* 15:   */   implements ActionListener
/* 16:   */ {
/* 17:   */   private JComboBox comboBox_;
/* 18:   */   private JPanel panel_;
/* 19:   */   private Property property_;
/* 20:   */   
/* 21:   */   public ComboBoxComponent(Property property)
/* 22:   */     throws PropertyException
/* 23:   */   {
/* 24:59 */     this.property_ = property;
/* 25:60 */     this.panel_ = new JPanel();
/* 26:61 */     GridBagLayout layout = new GridBagLayout();
/* 27:62 */     this.panel_.setLayout(layout);
/* 28:63 */     GridBagConstraints c = new GridBagConstraints();
/* 29:64 */     c.fill = 2;
/* 30:65 */     JLabel label = new JLabel(property.getName());
/* 31:66 */     this.comboBox_ = new JComboBox(this.property_.getAllowedValues());
/* 32:67 */     layout.setConstraints(this.comboBox_, c);
/* 33:68 */     this.comboBox_.setToolTipText(property.getDescription());
/* 34:69 */     this.panel_.add(this.comboBox_);
/* 35:70 */     this.comboBox_.addActionListener(this);
/* 36:   */   }
/* 37:   */   
/* 38:   */   public Component getComponent()
/* 39:   */   {
/* 40:81 */     return this.panel_;
/* 41:   */   }
/* 42:   */   
/* 43:   */   public void actionPerformed(ActionEvent e)
/* 44:   */   {
/* 45:86 */     Class wrapperClass = PrimitiveClasses.getWrapperClass(this.property_.getType());
/* 46:   */     try
/* 47:   */     {
/* 48:89 */       if (wrapperClass == null) {
/* 49:90 */         getPropertyEditor().setAsText((String)this.comboBox_.getSelectedItem());
/* 50:   */       }
/* 51:   */     }
/* 52:   */     catch (Exception err)
/* 53:   */     {
/* 54:96 */       err.printStackTrace();
/* 55:   */     }
/* 56:   */   }
/* 57:   */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\atomikos-util\3.7.0\atomikos-util-3.7.0.jar
 * Qualified Name:     com.atomikos.beans.ComboBoxComponent
 * JD-Core Version:    0.7.0.1
 */